﻿<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="Хранилище ModelRailway" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
  <!--Ошибки, обнаруженные при создании:
предупреждение 6002: В таблице или представлении "D:\ППК СГТУ\4 КУРС\УЧЕБНАЯ ПРАКТИКА (1 СЕМЕСТР)\GUI_CONTOL_DB_RAILWAY\DB\RAILWAY852.MDF.dbo.AuthorizationTable" не определен первичный ключ. Ключ был выведен, а определение таблицы или представления было создано в режиме только для чтения.-->
  <EntityType Name="AuthorizationTable">
    <Key>
      <PropertyRef Name="login" />
      <PropertyRef Name="password" />
    </Key>
    <Property Name="login" Type="varchar" MaxLength="20" Nullable="false" />
    <Property Name="password" Type="varchar" MaxLength="8" Nullable="false" />
  </EntityType>
  <EntityType Name="Roads">
    <Key>
      <PropertyRef Name="roadID" />
    </Key>
    <Property Name="roadID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="nameRoad" Type="nvarchar" MaxLength="40" Nullable="false" />
    <Property Name="typeRoad" Type="nvarchar" MaxLength="20" Nullable="false" />
    <Property Name="categoryQuality" Type="nvarchar" MaxLength="20" Nullable="false" />
  </EntityType>
  <EntityType Name="Stations">
    <Key>
      <PropertyRef Name="stationID" />
    </Key>
    <Property Name="stationID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="typeStationID" Type="int" Nullable="false" />
    <Property Name="nameStation" Type="nvarchar" MaxLength="40" Nullable="false" />
    <Property Name="image" Type="image" />
    <Property Name="overheadTransition" Type="bit" Nullable="false" />
    <Property Name="location" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="Stations_Roads">
    <Key>
      <PropertyRef Name="stationID" />
      <PropertyRef Name="roadID" />
    </Key>
    <Property Name="stationID" Type="int" Nullable="false" />
    <Property Name="roadID" Type="int" Nullable="false" />
  </EntityType>
  <EntityType Name="TypeStation">
    <Key>
      <PropertyRef Name="typeStationID" />
    </Key>
    <Property Name="typeStationID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="nameTypeStation" Type="nvarchar" MaxLength="40" Nullable="false" />
    <Property Name="passagerService" Type="bit" Nullable="false" />
  </EntityType>
  <Association Name="FK_Stations">
    <End Role="TypeStation" Type="Self.TypeStation" Multiplicity="1" />
    <End Role="Stations" Type="Self.Stations" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="TypeStation">
        <PropertyRef Name="typeStationID" />
      </Principal>
      <Dependent Role="Stations">
        <PropertyRef Name="typeStationID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK1_Stations_Roads">
    <End Role="Stations" Type="Self.Stations" Multiplicity="1">
      <OnDelete Action="Cascade" />
    </End>
    <End Role="Stations_Roads" Type="Self.Stations_Roads" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Stations">
        <PropertyRef Name="stationID" />
      </Principal>
      <Dependent Role="Stations_Roads">
        <PropertyRef Name="stationID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK2_Stations_Roads">
    <End Role="Roads" Type="Self.Roads" Multiplicity="1">
      <OnDelete Action="Cascade" />
    </End>
    <End Role="Stations_Roads" Type="Self.Stations_Roads" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Roads">
        <PropertyRef Name="roadID" />
      </Principal>
      <Dependent Role="Stations_Roads">
        <PropertyRef Name="roadID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <EntityContainer Name="Хранилище ModelRailwayContainer">
    <EntitySet Name="Roads" EntityType="Self.Roads" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Stations" EntityType="Self.Stations" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Stations_Roads" EntityType="Self.Stations_Roads" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="TypeStation" EntityType="Self.TypeStation" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="AuthorizationTable" EntityType="Self.AuthorizationTable" store:Type="Tables" store:Schema="dbo">
      <DefiningQuery>SELECT 
[AuthorizationTable].[login] AS [login], 
[AuthorizationTable].[password] AS [password]
FROM [dbo].[AuthorizationTable] AS [AuthorizationTable]</DefiningQuery>
    </EntitySet>
    <AssociationSet Name="FK_Stations" Association="Self.FK_Stations">
      <End Role="TypeStation" EntitySet="TypeStation" />
      <End Role="Stations" EntitySet="Stations" />
    </AssociationSet>
    <AssociationSet Name="FK1_Stations_Roads" Association="Self.FK1_Stations_Roads">
      <End Role="Stations" EntitySet="Stations" />
      <End Role="Stations_Roads" EntitySet="Stations_Roads" />
    </AssociationSet>
    <AssociationSet Name="FK2_Stations_Roads" Association="Self.FK2_Stations_Roads">
      <End Role="Roads" EntitySet="Roads" />
      <End Role="Stations_Roads" EntitySet="Stations_Roads" />
    </AssociationSet>
  </EntityContainer>
</Schema>